//
//  TopicNineModelCell.m
//  BobNews
//
//  Created by lanou3g on 16/5/11.
//  Copyright © 2016年 YJC. All rights reserved.
//

#import "TopicNineModelCell.h"
#import "UIImageView+WebCache.h"
#import "BigImageView.h"
@interface TopicNineModelCell ()
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;
@property (weak, nonatomic) IBOutlet UIImageView *firstImgView;
@property (weak, nonatomic) IBOutlet UIImageView *secondImgView;
@property (weak, nonatomic) IBOutlet UIImageView *thirdImgView;
@property (weak, nonatomic) IBOutlet UIImageView *fourthImgView;
@property (weak, nonatomic) IBOutlet UIImageView *fifthImgView;
@property (weak, nonatomic) IBOutlet UIImageView *sixImgView;
@property (weak, nonatomic) IBOutlet UIImageView *sevenImgView;
@property (weak, nonatomic) IBOutlet UIImageView *eightImgView;
@property (weak, nonatomic) IBOutlet UIImageView *nineImgView;
@property (weak, nonatomic) IBOutlet UILabel *cTimeLabel;
@property (weak, nonatomic) IBOutlet UILabel *disLabel;

@end
@implementation TopicNineModelCell
- (void)setModel:(TopicNineModel *)model {
    if (_model != model) {
        _model = model;
    }
}
- (void)layoutSubviews {
    self.contentLabel.text = self.model.content;
    [self.firstImgView sd_setImageWithURL:[NSURL URLWithString:self.model.picurl[0]]];
    [self.secondImgView sd_setImageWithURL:[NSURL URLWithString:self.model.picurl[1]]];
    [self.thirdImgView sd_setImageWithURL:[NSURL URLWithString:self.model.picurl[2]]];
    [self.fourthImgView sd_setImageWithURL:[NSURL URLWithString:self.model.picurl[3]]];
    [self.fifthImgView sd_setImageWithURL:[NSURL URLWithString:self.model.picurl[4]]];
    [self.sixImgView sd_setImageWithURL:[NSURL URLWithString:self.model.picurl[5]]];
    [self.sevenImgView sd_setImageWithURL:[NSURL URLWithString:self.model.picurl[6]]];
    [self.eightImgView sd_setImageWithURL:[NSURL URLWithString:self.model.picurl[7]]];
    [self.nineImgView sd_setImageWithURL:[NSURL URLWithString:self.model.picurl[8]]];
    self.cTimeLabel.text = [NSString stringWithFormat:@"%@",self.model.cTime];
    self.disLabel.text = [NSString stringWithFormat:@"%@跟帖",self.model.discussCount];

    self.firstImgView.userInteractionEnabled = YES;
    self.secondImgView.userInteractionEnabled = YES;
    self.thirdImgView.userInteractionEnabled = YES;
    self.fourthImgView.userInteractionEnabled = YES;
    self.fifthImgView.userInteractionEnabled = YES;
    self.sixImgView.userInteractionEnabled = YES;
    self.sevenImgView.userInteractionEnabled = YES;
    self.eightImgView.userInteractionEnabled = YES;
    self.nineImgView.userInteractionEnabled = YES;
    
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(bigImageViewAction:)];
    [self.firstImgView addGestureRecognizer:tap];
    UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(bigImageViewSecondAction:)];
    [self.secondImgView addGestureRecognizer:tap1];
    UITapGestureRecognizer *tap2 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(bigImageViewThirdAction:)];
    [self.thirdImgView addGestureRecognizer:tap2];
    
    UITapGestureRecognizer *tap3 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(bigImageViewfourthAction:)];
    [self.fourthImgView addGestureRecognizer:tap3];
    UITapGestureRecognizer *tap4 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(bigImageViewfifthAction:)];
    [self.fifthImgView addGestureRecognizer:tap4];
    
    UITapGestureRecognizer *tap5 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(bigImageViewsixAction:)];
    [self.sixImgView addGestureRecognizer:tap5];
    UITapGestureRecognizer *tap6 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(bigImageViewsevenAction:)];
    [self.sevenImgView addGestureRecognizer:tap6];
    UITapGestureRecognizer *tap7 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(bigImageViewEightAction:)];
    [self.eightImgView addGestureRecognizer:tap7];
    UITapGestureRecognizer *tap8 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(bigImageViewNineAction:)];
    [self.nineImgView addGestureRecognizer:tap8];
}
- (void)bigImageViewAction:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.firstImgView];
}
- (void)bigImageViewSecondAction:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.secondImgView];
}

- (void)bigImageViewThirdAction:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.thirdImgView];
}
- (void)bigImageViewfourthAction:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.fourthImgView];
}
- (void)bigImageViewfifthAction:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.fifthImgView];
}
- (void)bigImageViewsixAction:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.sixImgView];
}
- (void)bigImageViewsevenAction:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.sevenImgView];
}
- (void)bigImageViewEightAction:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.eightImgView];
}
- (void)bigImageViewNineAction:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.nineImgView];
}

+ (CGFloat)height {
    return 360;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
